package com.markedquilt.demo.controller;
/*
 * PackageName: com.markedquilt.mvcframework.com.markedquilt.demo.controller
 * ClassName:   DemoController
 * Author:   coke
 * Date:     Created in 2020/10/21 21:35
 * Description:
 * History:
 * <author>        <time>             <version>          <desc>
 * 作者姓名         修改时间            版本号              描述
 * coke           2020/10/21 21:35     1.0
 */

import com.markedquilt.demo.service.IDemoService;
import com.markedquilt.mvcframework.anntations.LagouAutowired;
import com.markedquilt.mvcframework.anntations.LagouController;
import com.markedquilt.mvcframework.anntations.LagouRequestMapping;
import com.markedquilt.mvcframework.anntations.MySecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author ZhangKe
 * @Project mvc-demo
 * @Description
 * @date 2020/10/21 21:35.
 */
@LagouController
@LagouRequestMapping("/demo")
@MySecurity("admin")
public class DemoController {

    @LagouAutowired
    private IDemoService demoService;

    /**
     * URL : /demo/query
     * @param request
     * @param response
     * @param name
     * @return
     */
    @LagouRequestMapping("/query")
    @MySecurity("zhangsan")
    public String query1(HttpServletRequest request, HttpServletResponse response,String name){
        return "访问/demo/query，用户：" + demoService.get(name);
    }

    /**
     * URL : /demo/query
     * @param request
     * @param response
     * @param name
     * @return
     */
    @LagouRequestMapping("/select")
    @MySecurity({"zhangsan","lisi"})
    public String query2(HttpServletRequest request, HttpServletResponse response,String name){
        return "访问/demo/select，用户：" + demoService.get(name);
    }
}
